home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 March / EnigmA AMIGA RUN 25 (1997)(G.R. Edizioni)(IT)[!][issue 1998-03].iso / recent2 / poolmem.readme < prev    next >
Text File  |  1998-02-19  |  11KB  |  287 lines

  1. Short:    Memory defragmentizer/AllocP superset
  2. Author:   thor@math.tu-berlin.de (Thomas Richter)
  3. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  4. Version:  1.20
  5. Type:     util/sys
  6. Requires: OS 2.0 at least
  7.  
  8. ______________________________________________________________________________
  9.  
  10. NEWS FLASH: Found serious bug in XiPaint that caused crashes with PoolMem,
  11. check below for details.
  12. ______________________________________________________________________________
  13.  
  14. 1.20:
  15.  
  16. Added the CHIPFWD command. Works like INSTALL but allocates chip mem in
  17. standard (forwards) mode instead of backwards mode. Might solve strange
  18. compatibility problems. Added more sanity checks, included PatchReplyMsg
  19. to create warnings for broken programs.
  20.  
  21. 1.19.1:
  22.  
  23. Changed the name of the DefragMeter to FragMeter because that makes more
  24. sense. Added a chunk count to this program. PoolMem itself unchanged.
  25. ______________________________________________________________________________
  26.  
  27. About PoolMem:
  28.     
  29.     If you run a lot of programs without resetting the system, you'll
  30. usually find that the main memory of the computer is getting "messed up",
  31. split in lots of tiny memory "snippets" that are more or less useless due to
  32. their tinyness. It may happen that you can't start an application even though
  33. enough memory is available - because this memory is too fragmentated to
  34. be of any use.
  35.  
  36. That's the point where PoolMem tries to help you: It manages the main memory
  37. in a way such that it can't get fragmentated too easely. It replaces also
  38. the function of AllocP, which is therefore obsolete.
  39.  
  40. ______________________________________________________________________________
  41.  
  42. Installation and Usage:
  43.  
  44.     Copy the PoolMem program in this archive to the C: directory of your
  45. system partition. Add the following line to your startup-sequence:
  46.  
  47. PoolMem >NIL:
  48.  
  49.  
  50. You might also want to install "PatchRAM" which is included in this archive,
  51. too. It modifies the system RAM disk in a way that avoids memory 
  52. fragmentation, too. Another bonus is that the RAM disk will show its true
  53. size from now on, i.e. it won't be no longer 100% full.
  54.  
  55.  
  56. To remove PoolMem later on, open a shell window and enter
  57.  
  58. PoolMem remove
  59.  
  60.  
  61. Other command line options:
  62.  
  63. PoolMem install        Identical to the standard installation
  64.  
  65. PoolMem    ChipFwd        Doesn't allocate chip memory backwards. Might solve
  66.             compatibility problems, but isn't perfect for the
  67.             fragmentation.
  68. ______________________________________________________________________________
  69.  
  70. Compatibility:
  71.  
  72.     There are a couple of relatively deep patches of the memory system
  73. that shouldn't be run together with PoolMem:
  74.  
  75. - SetPatch:    The 68040 library which is loaded by this program seems
  76.         to allocate the MMU tables in a strange way incompatible
  77.         to the scratch list of PoolMem. Easy solution: run
  78.         PoolMem after SetPatch.
  79. - MemSniff:    (The THOR MungWall replacement)    Patches deep into the memory
  80.         allocation routines, too deep for PoolMem.
  81.  
  82. I guess that's all for now...
  83.  
  84.  
  85. Buggy programs that crash with PoolMem installed:
  86.  
  87. - XiPaint 3.2 (or XMouse, to be precise):
  88.  
  89. The message handling of the mouse driver is broken. After a long debug 
  90. session deep into the night, I found that the crashes were created by the
  91. mouse driver XMouse. It replies messages that are no longer valid and have
  92. been FreeMem()'d before. THIS IS DEFINITELY ILLEGAL AND NOT A POOLMEM PROBLEM.
  93.  
  94. To help you checking other programs as well, I included a tiny patch
  95. "PatchReplyMsg". You shouldn't install it permanently, though, because it
  96. slows down the message system. If, after installation of this patch, a 
  97. program crashes with guru 0x01000001f, THEN THIS PROGRAM HAS THE SAME BUG
  98. AS XIPAINT and replies illegal messages. This will crash your system anyways,
  99. with or without PoolMem. Please sent a bug report to the author, or remove
  100. these programs. As I said, THIS IS NO POOLMEM problem.
  101.  
  102.  
  103. The guru 0x01000013 is rather typical for these programs - they invalidate
  104. the internal scratch list of PoolMem.
  105.  
  106. ______________________________________________________________________________
  107.  
  108. Theory of operation:
  109.  
  110.     PoolMem splits all available memory in two blocks: One block is used 
  111. for the small memory snippets (always taken from there), the other block is used
  112. for huge allocations. This partition of the main memory is dynamic, i.e. each
  113. sub-pool can grow and shrink, depending on the memory requirements.
  114.  
  115. The "public/ANY" memory gets a special treatment. PoolMem manages a "scratch"
  116. list for tiny memory blocks taken from there. Instead of taking these tiny
  117. memory blocks always from the main memory, they are taken from this (global,
  118. though) memory pool and put back into this pool if they get freed. A special
  119. garbage collection task cleans this "scratch list" from time to time, or if
  120. it overruns. The main profit is taken from the layers.library, which uses to
  121. allocate tons of tiny snippets and is therefore the main cause for memory
  122. fragmentation.
  123.  
  124. The "chip" memory is treated a bit different. It's also split into two 
  125. distinct memory pools (small and large), but memory from the large pool
  126. is allocated in reverse direction - unless you run PoolMem with the
  127. ChipFwd keyword, of course; this happens for two reasons: First, it
  128. helps to keep the memory defragmentated, so the big pool can't run that
  129. easely into the small pool. Second, it works around a hardware bug of my
  130. computer (the refresh of the high end chip memory in my computer seems to
  131. be a bit buggy - some bits tend to flip if they aren't frequently accessed,
  132. for example by the DMA processor as display memory.)
  133.  
  134. For details about the PatchRAM program, check its readme file. As I said, if
  135. you run PoolMem, you're supposed to run PatchRAM as well. It helps PoolMem
  136. a lot in its job!
  137.  
  138. _________________________________________________________________________________
  139.  
  140. Additional programs:
  141.  
  142. The PoolMem program is still in a somewhat experimental stage, even though
  143. it's running stable for my system for more than two years now - I won't
  144. expect any serious bugs, though.
  145. However, if you like to see how PoolMem works and if it has any effects, I
  146. provided several extra programs:
  147.  
  148. ShowMem:        Shows the allocated/free memory in a graphical over-
  149.             view. For details, check the ShowMem readme and its
  150.             guide. (Available separately as well)
  151.  
  152. PatchRAM:        Modifies and improves the RAM disk. Shows the correct
  153.             size of the RAM drive, improves the memory allocation
  154.             sheme of it as well. Should be run together with
  155.             PoolMem. For details, check the guide of PatchRAM.
  156.  
  157. FragMeter:        Calculates the fragmentation of your memory. The
  158.             output is given separately for each memory type.
  159.             A 100% defragmentation indicates that all the free
  160.             memory is messed up in tiny blocks of eight bytes
  161.             each (maximal defragmentation).
  162.             A Shannon-type approach is used to measure the
  163.             defragmentation (the algorithm calculates the
  164.             Shannon entropy of the memory blocks with the formula
  165.             sum += log(chunk->mc_Bytes/total)
  166.             If you've a better approach for measuring the
  167.             fragmentation, lemme now. This here seems at least
  168.             reasonable for me as a theoretical physicst... ;-)
  169.             
  170.             This program can be used to test the efficency of
  171.             PoolMem. My measurements indicate that the entropy is
  172.             about halved.
  173.  
  174. MemoryMess:        A program that tries to fragmentate the main memory
  175.             as worse as possible by allocating and freeing memory
  176.             in random order. Can be used together with the 
  177.             FragMeter to measure the efficiency of PoolMem or
  178.             with ShowMem to watch PoolMem at its job. Can be
  179.             canceled safely with ^C (Control-C). Does nothing
  180.             useful except that.
  181.  
  182. PatchReplyMsg:        Useful to find buggy programs, like XiPaint.
  183.             PatchReplyMsg will create a guru 0x0100001f if a
  184.             program attempts to reply an already de-allocated
  185.             message. Don't install it permanently, but use it
  186.             to find the reason for crashes.
  187.  
  188.  
  189. If you've ideas how to improve PoolMem, lemme know....
  190.  
  191. ______________________________________________________________________________
  192.  
  193. Guru meditations thrown by PoolMem:
  194.  
  195. 0x01000013        Scratch entry illegal.
  196.  
  197.             Some program invalidated the internal memory scratch
  198.             list of PoolMem - by overwriting memory that has been
  199.             deallocated before. An (in)famous example is XiPaint.
  200.             Run "PatchReplyMsg" and a debugger (e.g. COP) to check
  201.             for details.
  202.  
  203. 0x0100000f        MemHeader not found.
  204.  
  205.             Some program attempted to free a non-existing block
  206.             of memory. PoolMem (or exec) wasn't able to locate
  207.             the MemHeader.
  208.  
  209.  
  210. 0x01000011        MemHeader insane.
  211.  
  212.             PoolMem found a MemHeader whose number of available
  213.             bytes does not match the size of its pool.
  214.  
  215.  
  216. 0x01000012        Invalid DeleteHeader (internal).
  217.  
  218.             Someone tried to deallocate the "large" memory pool.
  219.             This is an internal guru, shouldn't happen. 
  220.  
  221. ______________________________________________________________________________
  222.  
  223.                         The THOR-Software Licence
  224.  
  225.  
  226. This License applies to the computer programs known as "PoolMem", "ShowMem",
  227. "FragMeter", "MemoryMess" and "ShowMem".
  228. The "Program", below, refers to such program.
  229.  
  230.  
  231. The programs and files in this distribution are freely distributable
  232. under the restrictions stated below, but are also Copyright (c)
  233. Thomas Richter.
  234.  
  235.  
  236. Distribution of the Program by a commercial organization without written
  237. permission from the author to any third party is prohibited if any payment
  238. is made in connection with such distribution, whether directly
  239. (as in payment for a copy of the Program) or indirectly (as in payment
  240. for some service related to the Program, or payment for some product
  241. or service that includes a copy of the Program "without charge";
  242. these are only examples, and not an exhaustive enumeration of prohibited
  243. activities). However, the following methods of distribution involving
  244. payment shall not in and of themselves be a violation of this restriction:
  245.  
  246.  
  247. (i) Posting the Program on a public access information storage and
  248. retrieval service for which a fee is received for retrieving information
  249. (such as an on-line service), provided that the fee is not
  250. content-dependent (i.e., the fee would be the same for retrieving the same
  251. volume of information consisting of random data).
  252.  
  253.  
  254.  
  255. (ii) Distributing the Program on a CD-ROM, provided that the files
  256. containing the Program are reproduced entirely and verbatim on such
  257. CD-ROM, and provided further that all information on such CD-ROM be
  258. redistributable for non-commercial purposes without charge.
  259.  
  260.  
  261.  
  262. Everything in this distribution must be kept together, in original
  263. and unmodified form.
  264.  
  265.  
  266.  
  267.  
  268. Limitations.
  269.  
  270. THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
  271. WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  272. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  273. PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
  274. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
  275. THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  276. SERVICING, REPAIR OR CORRECTION.
  277.  
  278.  
  279.  
  280. IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE ALL FILES CONTAINED IN
  281. THIS ARCHIVE.
  282.  
  283. ______________________________________________________________________________
  284.  
  285. Have fun,
  286.     Thomas        January 1998
  287.